package com.blockmeta.bbs.baselibrary.utils;

import android.content.Context;
import android.content.pm.ApplicationInfo;

/**
 * @author AirThor
 * @date 2019/6/14.
 * In multi modules project,Dependent module's BuildConfig is always release type
 */
public class BuildConfigUtil {
        private static Boolean isDebug = null;

        public static boolean isDebug() {
            return isDebug !=null && isDebug;
        }
        /**
         * Sync lib debug with app's debug value. Should be called in module Application
         */
        public static void syncIsDebug(Context context) {
            if (isDebug == null) {
                isDebug = context.getApplicationInfo() != null &&
                        (context.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
            }
        }
}
